package com.example.demo.entity;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

/**
 * @ClassName MyFactoryBean
 * @Author bsy
 * @Description TODO
 * @Date 2022/8/24 22:15
 * @Version 1.0
 */

@Component
public class MyFactoryBean implements FactoryBean {

    public Object getObject() throws Exception {
        String data1 = buildData1();
        String data2 = buildData2();
        return buildData3(data1, data2);
    }

    private String buildData1() {
        return "data1";
    }

    private String buildData2() {
        return "data2";
    }

    private String buildData3(String data1, String data2) {
        return data1 + data2;
    }

    @Override
    public Class<?> getObjectType() {
        return null;
    }
}
